package com.atguigu.x_ticket;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {
    public static void main(String[] args) {
        /*需求
        * 三个人卖五十张票*/
        ExecutorService executorService = Executors.newFixedThreadPool(3);

        for (int i = 1; i <= 50; i++) {
            int finalI = i;
            executorService.submit(()->{
                System.out.println(Thread.currentThread().getName()+"卖了第"+ finalI +"张票");
            });
        }

        executorService.shutdown();
    }
}
